using System;
using System.Text;
using System.Collections.Generic;
using iBeauty.BusinessObjects;
using iBeauty.DAL;

namespace iBeauty.BLL
{
	public class BillDetailBLL
	{
		private BillDetailDAO _BillDetailDAO;

		public BillDetailDAO BillDetailDAO
		{
			get { return _BillDetailDAO; }
			set { _BillDetailDAO = value; }
		}

		public BillDetailBLL()
		{
			BillDetailDAO = new BillDetailDAO();
		}
		public List<BillDetail> GetBillDetails()
		{
			try
			{
				return BillDetailDAO.GetBillDetails();
			}
			catch(Exception ex)
			{
				throw ex;
			}
		}
		public BillDetail GetBillDetail(string ID)
		{
			try
			{
				return BillDetailDAO.GetBillDetail(ID);
			}
			catch(Exception ex)
			{
				throw ex;
			}
		}
		public int AddBillDetail(BillDetail oBillDetail)
		{
			try
			{
				return BillDetailDAO.AddBillDetail(oBillDetail);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int AddBillDetail(string ID,DateTime? CreateDate,DateTime? ModifiedDate,DateTime? TimeStamp,string LineNo,string ProductCode,string ProductName,string Quantity,Double? Price,Double? Total,Double? OddQuantity,Double? Content,int? UnitType,DateTime? ExpireDate,int? AccountId,string Note)
		{
			try
			{
				return BillDetailDAO.AddBillDetail(ID,CreateDate,ModifiedDate,TimeStamp,LineNo,ProductCode,ProductName,Quantity,Price,Total,OddQuantity,Content,UnitType,ExpireDate,AccountId,Note);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int UpdateBillDetail(BillDetail oBillDetail)
		{
			try
			{
				return BillDetailDAO.UpdateBillDetail(oBillDetail);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int UpdateBillDetail(string ID,DateTime? CreateDate,DateTime? ModifiedDate,DateTime? TimeStamp,string LineNo,string ProductCode,string ProductName,string Quantity,Double? Price,Double? Total,Double? OddQuantity,Double? Content,int? UnitType,DateTime? ExpireDate,int? AccountId,string Note)
		{
			try
			{
				return BillDetailDAO.UpdateBillDetail(ID,CreateDate,ModifiedDate,TimeStamp,LineNo,ProductCode,ProductName,Quantity,Price,Total,OddQuantity,Content,UnitType,ExpireDate,AccountId,Note);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int RemoveBillDetail(BillDetail oBillDetail)
		{
			try
			{
				return BillDetailDAO.RemoveBillDetail(oBillDetail);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int RemoveBillDetail(string ID)
		{
			try
			{
				return BillDetailDAO.RemoveBillDetail(ID);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public List<BillDetail> DeserializeBillDetails(string Path)
		{
			try
			{
				return GenericXmlSerializer<List<BillDetail>>.Deserialize(Path);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public void SerializeBillDetails(string Path, List<BillDetail> BillDetails)
		{
			try
			{
				GenericXmlSerializer<List<BillDetail>>.Serialize(BillDetails, Path);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
	}
}
